<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的订单</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
    <meta name="format-detection" content="telephone=no, email=no" />
    <link rel="stylesheet" href="{{ url('/common/mobile-common/common.css') }}">
    <link rel="stylesheet" href="{{ url('/mobile/css/member/common.css') }}">
    <link rel="stylesheet" href="{{ url('/mobile/css/member/order.css') }}">
    <script src="{{ url('mobile/js/jquery-1.8.3.min.js') }}"></script>
    <script src="{{ url('mobile/js/moreLoad/iscroll4.js') }}"></script>
	<script src="{{ url('mobile/js/moreLoad/pagination.js') }}"></script>
    <script src="{{ url('/common/mobile-common/hmt.js') }}"></script>
<style>
#pullDown, #pullUp {
    background: #fff;
    height: 40px;
    line-height: 40px;
    padding: 5px 10px;
    border-bottom: 1px solid #ccc;
    font-weight: bold;
    font-size: 14px;
    color: #888;
    text-align: center;
}
	</style>
</head>
<body>
<div class="abouts">
    <div class="wrap-cont clearfix">
        <!--头部导航-->
        <div class="top-menu">
            <ul class="clearfix">
                <li><a href="{{url('wap/order/list')}}">全部</a></li>
                <li><a href="{{url('wap/order/forPayList')}}">待付款</a></li>
                <li><a href="{{url('wap/order/forDeliveList')}}">待发货</a></li>
                <li><a class="nowsh">待收货</a></li>
            </ul>
        </div>
        <input name="page" type="hidden" value="2" id="page">
        <!--end-->
        @if(!empty(count($res)))
        <!--订单内容-->
        <div class="wap-cont" id="wrapper">
        	<div id="scroller">
        		<div id="pullDown">
					<span class="pullDownIcon"></span><span class="pullDownLabel">下拉刷新...</span>
				</div>
                <ul id="thelist">
                    @include('wap.order.receiveList-ajax')
                </ul>
        		<div id="pullUp">
					<span class="pullUpIcon"></span><span class="pullUpLabel">上拉加载更多...</span>
				</div>
        	</div>
           
        </div>
        @else
                <!--无订单-->
        <div class="have-noorder">
            <div class="contt">
                <img src="{{ url('mobile/images/wxgdd.png') }}" class="wxg">
                <p>您还没有相关的订单</p>
                <p>可以去看看有哪些想买的</p>
            </div>
        </div>
        @endif
        <!--end-->
    </div>
</div>

</body>
<!--分页-->
<script type="text/javascript">
    //上拉事件
    var m = 1;
    function pullUpAction() {

        setTimeout(function () {
            var page=$('#page').val();
            page=parseInt(page);
            getList(page);

            function getList(page){

                $.get("{{ url('wap/order/receiveListAjax') }}",{page:page},function(data){
                    var more = data.more;
                    if(more == 1){
                        $('#page').val(page+1);
                    }

                    if (m== 0) {
                        $('#pullUp').remove();
                        return false;
                    }

                    if(more == 0){
                        m = 0;
                    }

                    if(data.html){
                        $('#thelist').append(data.html);
                        myScroll.refresh();
                    }

                });
            };
        }, 1000);
    }
</script>
<script>
    $(function(){
        //导航切换样式
        $(".top-menu li").click(function(){
            $(".top-menu li a").removeClass("nowsh");
            $(this).find("a").addClass("nowsh");
        })

        $(".qrsh").click(function(){
            var id = $(this).data('id');
            if(confirm("确认收货吗？")) {
                $.ajax({
                    url: "{{ url('wap/order/confirmReceive') }}",
                    type: "post",
                    dataType: "json",
                    data: {id: id},
                    success: function (data) {
                        if (data.success) {
                            location.reload();
                        }
                        else {
                            layer.alert(data.msg);
                        }
                    }
                })
            }
        })
    })
</script>
</html>
